 <%@page import="java.util.ArrayList"%>
<%@page import="com.wanmait.shoppingsys.util.ManagePager"%>
 <%@page import="com.wanmait.shoppingsys.vo.Type"%> 
 <%@page import="java.util.List"%>
<%@page import="com.wanmait.shoppingsys.vo.Specialty"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getServletContext().getContextPath();
%>
 
<jsp:include page="/manageinc/header.jsp"></jsp:include>

<section>
<h2>删减信息列表</h2>
<%
String name = request.getParameter("name");
if(name==null) name="";
%>
 
<form action="/ShoppingSys/SpecialtyManageController?action=find" method="post">
	<fieldset>
		<select name="specialtyId">
				<%
				List<Type> types = (List<Type>)request.getAttribute("Types");
				for(int i=0;types!=null&&i<types.size();i++){
					Type type = types.get(i);
					%>
					<option value="<%=type.getId()%>"><%=type.getKind() %></option>
					<%
				}
				%>
				</select>
		<input type="text" name="name" value="<%=name%>">
		<input type="submit" value="搜索">
	</fieldset>
</form>
<table width="100%" border="1">
<th width="100">序号</th>
<th>物品</th>

<th>操作</th>
<% 

ManagePager managepager=(ManagePager)request.getAttribute("managerpager");
ArrayList<Specialty> specialtys = (ArrayList<Specialty>)managepager.getData(); 

for(int i=0;specialtys!=null&&i<specialtys.size();i++){
	Specialty specialty=specialtys.get(i);
%>
<tr>
<td><%=i+1%></td>
<td><%=specialty.getName()%></td>
<td><a href="/ShoppingSys/SpecialtyManageController?action=delete&specialtyId=<%=specialty.getId()%>">删除</a></td>

</tr>
<%
}
%>
</table>
<div class="pagenation">
<%if(managepager.hasPrev()){ %>
<a href="<%=path%>/SpecialtyManageController?action=findall&pageNum=<%=managepager.getPageNum()-1%>">&lt;&lt;</a>
<%} %>

<%
	int k = 0;
	for(int i=managepager.getPageNum();i<=managepager.getPageCount();i++){
	k++;
	%>
	<a href="<%=path%>/SpecialtyManageController?action=findall&pageNum=<%=i%>"  

class="<%=managepager.getPageNum()==i?"cur":"" %>"   ><%=i %></a>	
	<%if(k==5){break;} %>
	<%}%>	
<%if(managepager.hasNext()) {%>
<a href="<%=path%>/SpecialtyManageController?action=findall&pageNum=<%=managepager.getPageNum()+1%>">&gt;&gt;</a>
<%} %>	


</div>
</section>
<%-- <jsp:include page="/inc/footer.jsp"></jsp:include> --%>